package com.lord.base.thread;

/**
 * 多线程
 * @author xj_xiaocheng
 * @Data   2013-7-19
 */
public class RunnableBase implements Runnable {
	private String threadName;
	private Integer count = 10;
	
	public String getThreadName() {
		return threadName;
	}

	public void setThreadName(String threadName) {
		this.threadName = threadName;
	}

	public void run() {
		for (int i = 0; i < 20; i++) {
			if(this.count > 0) {
				System.out.println(Thread.currentThread().getName() + "正在买票：" + this.count--);
			}
		}
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		
		RunnableBase myRun = new RunnableBase();
		
		Thread thread1 = new Thread(myRun, "1号窗口");
		Thread thread2 = new Thread(myRun, "2号窗口");
		Thread thread3 = new Thread(myRun, "3号窗口");
		Thread thread4 = new Thread(myRun, "4号窗口");
		
		thread1.start();
		thread2.start();
		thread3.start();
		thread4.start();
	}

}
